single-cycle implementation